package z.explorer.task;

import java.util.List;

import javax.swing.ProgressMonitor;
import javax.swing.SwingUtilities;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import z.explorer.Main;
import z.explorer.core.task.Task;
import z.explorer.core.task.dao.TaskDAO;
import z.explorer.ui.Explorer;
import z.explorer.ui.common.Handler;
import z.explorer.ui.common.ZTablePanel;
import z.explorer.ui.component.walker.ZWalker;

public class TaskViewer implements Handler {

	private static Log log = LogFactory.getLog(TaskViewer.class);

	// private int progress = 0;

	@Override
	public void handle() {
		TaskDAO taskDao = (TaskDAO) Main.context.getBean("taskDAO");
		log.info("start to search task");
		List<Task> list = taskDao.searchAll();
		log.info("end in searching task");
		ZTablePanel ztp = new ZTablePanel(list);
		ZWalker walker = (ZWalker) Main.context.getBean("zWalker");
		walker.addPanel("taskViewer", ztp);
	}

	@Override
	public String getMessage() {
		// TODO Auto-generated method stub
		return "loading the data for task ...";
	}

}
